package com.xtoad.ecms.common.web.base;

import java.util.ArrayList;
import java.util.List;

/**
 * 树结构基础类
 *
 * @author xtoad
 * @date 2021/02/14
 */
public class TreeNode<T> extends BaseDTO {

    /**
     * 父节点
     */
    private T parent;

    /**
     * 子节点
     */
    private List<T> children = new ArrayList<>();

    /**
     * 获取 父节点
     */
    public T getParent() {
        return this.parent;
    }

    /**
     * 设置 父节点
     */
    public void setParent(T parent) {
        this.parent = parent;
    }

    /**
     * 获取 子节点
     */
    public List<T> getChildren() {
        return this.children;
    }

    /**
     * 设置 子节点
     */
    public void setChildren(List<T> children) {
        this.children = children;
    }

    @Override
    public String toString() {
        return "TreeNode{" +
                "parent=" + parent +
                ", children=" + children +
                "} " + super.toString();
    }
}
